<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>数据类型</title>
	<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
</head>
<body>
<script>
	//'use strict';
	var a = 123 //整数
	var b = 0.234 //浮点型
	var c = 1.23e5 //科学记数法
	var d = -99 //负数
	var e = NaN //Not a Number 无法计算结果时表示
	var f = Infinity // 无线大
	console.log("------------Number-----------");
	console.log("整数:" + a);
	console.log("浮点数：" + b);
	console.log("科学计数法:" + c);
	console.log("负数：" + d);
	console.log("NaN:" + e);
	console.log("无限大：" + f);
	console.log("------------四则运算-----------");
	console.log(1+2);
	console.log((1+2)*5/2);
	console.log(2/0);
	console.log(0/0);
	console.log(10%3);
	console.log(10.3%3);
	console.log("------------布尔值-----------");
	console.log(true);
	console.log(false);
	console.log(1 > 2);
	console.log(1 < 2);
	console.log("------------&&运算符-----------");
	console.log(true && true);
	console.log(true && false);
	console.log(true && true && false);
	console.log("------------||运算符-----------");
	console.log(true || false);
	console.log(false || true);
	console.log(false || false);
	console.log(true || true);
	console.log("------------NaN-----------");
	console.log(isNaN(NaN));
	console.log(isNaN(1));
	console.log(1 === 1);
	console.log(1 === 2);
	console.log("------------浮点数的比较-----------");
	var a = 1/3 === (1 - 2/3);
	console.log("1/3 === (1 - 2/3) :" + a);
	var b = Math.abs(1/3 - (1 - 2/3)) < 0.000001;
	console.log("Math.abs(1/3 - (1 - 2/3)) < 0.000001 :" + b);
	console.log("------------null和undefined-----------");
	console.log("null表示一个空值,undefined表示未定义,但实际上两者并没有什么差别 ")
	console.log("------------数组-----------");
	var arr1 = [1,2,3.123,'Hello',null,true];
	var arr2 = new Array(1,3.24,null,true);
	console.log(arr1);
	console.log(arr2);
	//javaScript对象由键值对组成键都是字符串类型，值可以是任意类型
	console.log("------------JavaScript对象-----------");
	var person = {
		name:"Bob",
		age:20,
		tags:['js',true,3.12],
		city:"BeiJing",
		hasCar:true,
		zipCode:null
	}
	console.log("person:" + person);
	console.log("person.age:" + person.age)
	console.log("------------JavaScript变量-----------");
	//js变量由字母，数字，_，$符号组成，不能使用while，if等关键字，也不能由数字开头
</script>
</body>
</html>